if(!jsx3.lang.Class.forName("ux.cdb.admin.mechanism.schema.loanassist.builder.SchemaLoanAssistBaseInfo")) {
	jsx3.lang.Class.defineClass("ux.cdb.admin.mechanism.schema.loanassist.builder.SchemaLoanAssistBaseInfo",
			ux.megatron.gui.WizardPanel,
			null,
			function (block) {
				/**
				 * instance initializer
				 * @param strName {String} unique name distinguishing this object from all other JSX GUI objects in the JSX application
				 * @param vntLeft {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntTop {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntWidth {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param vntHeight {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
				 * @param strHTML {String} Text/HTML markup to place in the jsx3.gui.Block instance
				 */
				
				block.prototype.wizard=null;
				block.prototype.init = function(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML) {
					//call constructor for super class (the super expects the name of the object and the function that it is an instance of)
					this.jsxsuper(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML);
				};

				block.prototype.initialize = function(msg) {
					this.wizard=this.getAncestorOfType("ux.cdb.admin.mechanism.schema.SchemaWizard");
					var me=this;
					//load the ORG_LEVEL
					this.getDescendantOfName("blkSignDate").getDescendantOfName("dateValue").setDate(new Date(),true);
					this.cacheLoaded();
					this.repaint();
				}
				/**
				 *  call back function of cache loaded
				 */
				block.prototype.cacheLoaded = function(){
					var me=this;
					var cache = ux.cdb.admin.CommonCache.getInstance();
					this.getDescendantOfName("blkCoopLevel").getDescendantOfName("selValue").setSourceXML(cache.getCache('CommonCache_COOPER_AGREEMENT_LEVEL_CODE'));
					ux.megatron.util.Dwr.callDwr("AddCooperAgreementUCC", "getCooperAgreementInitInfo", ["2401"], me, me.coopOrgLoaded);
					if (!this.wizard.isEdit)
					{//link the province to the current user
						this.getDescendantOfName("blkSignLocation").getDescendantOfName("selValue1").setValue(ux.cdb.admin.Privilege.getProvinceCode());
						this.getDescendantOfName("blkSignLocation").onSelectChanged();
					}
				}
				/**
				 * call back function when cooperation organization loaded
				 */
				block.prototype.coopOrgLoaded=function(message)
				{//cchAssistCenterNameList
					var i;
					var cacheAssistList=new jsx3.xml.CDF.Document.newDocument();
					
					console.log("\r\r received cooperation organization list \r\r\t"+ux.megatron.util.JSON.JSONtoString(message));

					for (i=0;i<message.content.data.length;i++)
					{
						cacheAssistList.insertRecord({
							jsxid:message.content.data[i].partyId,											
							jsxtext:message.content.data[i].chnFullName
						});

					}
					
					//put the data into the cache
					ux.megatron.Main.getServer().getCache().setDocument("cchAssistCenterNameList",cacheAssistList);
					
					if (this.wizard.isEdit)
					{//current mode is edit,get the baseinfo from server
						var editid=this.wizard.orgId+";"+this.wizard.schemaId;
						
						ux.megatron.util.Dwr.callDwr("MaintainCooperAgreementUCC", "getCooperAgreementDetailinfoForUpdate", [editid], this, this.baseinfoLoaded);

						console.log("\r\r\t[SchemaLoanAssistBaseInfo:65]\r\tsend message to getCooperAgreementDetailinfo by id["+editid+"]");
					}
					else
					{//not add mode next should be enabled
		
						
						this.wizard.getDescendantOfName("buttonPrev").setEnabled(jsx3.gui.Form.STATEENABLED, true);	
						//load default data
						ux.megatron.Main.loadResource("ux/cdb/admin/mechanism/schema/jss/LoanAssistCmpInitData_zh_cn.xml", "ux.cdb.admin", "cchLoadAssistCmpList", "xml");
						ux.megatron.Main.loadResource("ux/cdb/admin/mechanism/schema/jss/LoanAssistInterestInitData_zh_cn.xml", "ux.cdb.admin", "cchLoanAssistInterestList", "xml");
				
					}
				}
				
				
				//received the backmessage from server contain the baseinfo of the schema
				block.prototype.baseinfoLoaded=function(obj)
				{
					var message=obj.content.data[0];
					console.log("\r\r\t received the baseinfo message: \r\t"+ux.megatron.util.JSON.JSONtoString(obj));
					this.getDescendantOfName("blkSchemaLoanAssistBaseinfo").setDataByObject(message);
					this.wizard.eidtMessage=message;
					this.wizard.baseinfoid=message.cooperAgreementBasicInfoId;
					this.wizard.cooperAgmtDetailInfoId=message.cooperAgmtDetailInfoId;
					this.wizard.acctId=message.acctId;             
					this.wizard.subsidyPctId1=message.subsidyPctId1;       
					this.wizard.subsidyPctId2=message.subsidyPctId2;        
					this.wizard.subsidyPctId3=message.subsidyPctId3;         
					this.wizard.riskCompensationPctId1=message.riskCompensationPctId1;
					this.wizard.riskCompensationPctId2=message.riskCompensationPctId2;
					this.wizard.riskCompensationPctId3=message.riskCompensationPctId3;
					var server=ux.megatron.Main.getServer();

					var cacheIntr=new jsx3.xml.CDF.Document.newDocument();
					var cacheCmp=new jsx3.xml.CDF.Document.newDocument();
					//generator the cdf for the loan assist interest ratio
				
					cacheIntr.insertRecord({
							jsxid:message.enrollTypeCodeSubsidy1,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType0"),
							jsxcenter:message.centralFinanceSubsidyPct1,					
							jsxprovince:message.provinceFinanceSubsidyPct1,
							jsxcity:message.cityFinanceSubsidyPctSubsidy1,
							jsxcounty:message.countyFinanceSubsidyPct1,
							jsxothers:message.otherPartSubsidyPct1		
											});
					cacheIntr.insertRecord({
							jsxid:message.enrollTypeCodeSubsidy2,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType1"),
							jsxcenter:message.centralFinanceSubsidyPct2,					
							jsxprovince:message.provinceFinanceSubsidyPct2,
							jsxcity:message.cityFinanceSubsidyPctSubsidy2,
							jsxcounty:message.countyFinanceSubsidyPct2,
							jsxothers:message.otherPartSubsidyPct2		
											});
					cacheIntr.insertRecord({
							jsxid:message.enrollTypeCodeSubsidy3,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType2"),
							jsxcenter:message.centralFinanceSubsidyPct3,					
							jsxprovince:message.provinceFinanceSubsidyPct3,
							jsxcity:message.cityFinanceSubsidyPctSubsidy3,
							jsxcounty:message.countyFinanceSubsidyPct3,
							jsxothers:message.otherPartSubsidyPct3		
											});
					
					this.wizard.interestother=message.otherSharePartyNameSubsidy1;
					//put the data into the cache
					ux.megatron.Main.getServer().getCache().setDocument("cchLoanAssistInterestList",cacheIntr);
					//generator the cache for loan assist compensate
					cacheCmp.insertRecord({
							jsxid:message.enrollTypeCode1,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType0"),
							jsxcenter:message.centralFinanceSharedPct1,					
							jsxprovince:message.provinceFinanceSharePct1,
							jsxcity:message.cityFinanceSubsidyPct1,
							jsxcounty:message.countyFinanceSharePct1,
							jsxothers:message.otherPartSharePct1		
											});
					cacheCmp.insertRecord({
							jsxid:message.enrollTypeCode2,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType1"),
							jsxcenter:message.centralFinanceSharedPct2,					
							jsxprovince:message.provinceFinanceSharePct2,
							jsxcity:message.cityFinanceSubsidyPct2,
							jsxcounty:message.countyFinanceSharePct2,
							jsxothers:message.otherPartSharePct2		
											});
					cacheCmp.insertRecord({
							jsxid:message.enrollTypeCode3,											
							jsxtype:server.getDynamicProperty("@cdb@Mechanism@Assist@InterestMatrixType2"),
							jsxcenter:message.centralFinanceSharedPct3,					
							jsxprovince:message.provinceFinanceSharePct3,
							jsxcity:message.cityFinanceSubsidyPct3,
							jsxcounty:message.countyFinanceSharePct3,
							jsxothers:message.otherPartSharePct3		
											});
					this.wizard.cmpother=message.otherSharePartyName1;
					this.wizard.cmpRatio=message.riskSharePct;
					//put the "超出风险补偿资金的贷款损失分担比例" into the wizard
					this.wizard.cdbChargeLossPct=message.cdbChargeLossPct;
					this.wizard.cooperOrgChargeLossPct=message.cooperOrgChargeLossPct;
					//put the data into the cache
					ux.megatron.Main.getServer().getCache().setDocument("cchLoadAssistCmpList",cacheCmp);
					//all baseinfo loaded init the step2&3

				
				}

				block.prototype.onNext = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					if (this.doValidate() != true) 
					{
		
						return "NONE";
					}
					return null;
				}
				/**
				 * validate user input
				 */
				
				block.prototype.doValidate=function()
				{
					var message=ux.megatron.Main.getServer().getDynamicProperty("@cdb@Mechanism@Schema@ValidateFailure");
					var reval=true;
					var msg=this.getDescendantOfName("blkSchemaLoanAssistBaseinfo").doValidate();
					var tip;
					if (msg != null) {
						tip= msg[0].label ? msg[0].label + ":" +msg[0].message : msg[0].message;
						this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").setWarnMessage(tip);
						return false;
					}
					
					//validate the min limit
					if (this.getDescendantOfName("blkMinLimit").getDescendantOfName("txtValue").getValue()<1000 || parseInt(this.getDescendantOfName("blkMinLimit").getDescendantOfName("txtValue").getValue())>parseInt(this.getDescendantOfName("blkMaxLimit").getDescendantOfName("txtValue").getValue()))
					{
						message=ux.megatron.Main.getServer().getDynamicProperty("@cdb@Mechanism@Schema@LoanMinLimit");
						this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").setWarnMessage(message);
						this.getDescendantOfName("blkMinLimit")._validateFailedUI(true,message);
						return false;
					}
					else
					{
						this.getDescendantOfName("blkMinLimit")._validateFailedUI(false,"");
					}
					
					
					//validate the max limit
					if (this.getDescendantOfName("blkMaxLimit").getDescendantOfName("txtValue").getValue()>6000 ||this.getDescendantOfName("blkMaxLimit").getDescendantOfName("txtValue").getValue()<=0)
					{
						message=ux.megatron.Main.getServer().getDynamicProperty("@cdb@Mechanism@Schema@LoanMaxLimit");
						this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").setWarnMessage(message);
						this.getDescendantOfName("blkMaxLimit")._validateFailedUI(true,message);
						return false;
					}
					else
					{
						this.getDescendantOfName("blkMaxLimit")._validateFailedUI(false,"");
					}
					//validate the term limit
					if (this.getDescendantOfName("blkTermLimit").getDescendantOfName("txtValue").getValue()>14 || (this.getDescendantOfName("blkTermLimit").getDescendantOfName("txtValue").getValue()<=0))
					{
						message=ux.megatron.Main.getServer().getDynamicProperty("@cdb@Mechanism@Schema@LoanTermLimit")
						this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").setWarnMessage(message);
						this.getDescendantOfName("blkTermLimit")._validateFailedUI(true,message);
						return false;
					}
					else
					{
						this.getDescendantOfName("blkTermLimit")._validateFailedUI(false,"");
					}
					
					//validate the DeductPct
					if (parseInt(this.getDescendantOfName("blkDeductPct").getDescendantOfName("txtValue").getValue())<0 || parseInt(this.getDescendantOfName("blkDeductPct").getDescendantOfName("txtValue").getValue())>100)
					{
						message=ux.megatron.Main.getServer().getDynamicProperty("@cdb@Mechanism@Schema@DeductPct");
						this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").setWarnMessage(message);
						this.getDescendantOfName("blkDeductPct")._validateFailedUI(true,message);
						return false;
					}
					else
					{
						this.getDescendantOfName("blkDeductPct")._validateFailedUI(false,"");
					}
	
					this.getAncestorOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.Builder").clearWarnMessage();
			
					return true;
				}
				

				block.prototype.onPrev = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {

					var content=this.wizard.getDescendantOfName("blkContent");
					content.removeChildren();
					ux.megatron.Main.loadUIResourceAsync(content, "ux.cdb.admin", "ux/cdb/admin/mechanism/schema/ui/SchemaSelectType.xml", null);
		
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onRevert = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					return null; // return "NONE" to not last status
				}

				block.prototype.onCancel = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					this.getAncestorOfType("ux.cdb.admin.mechanism.schema.SchemaWizard").onCancel();
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onCustomNav = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onBeforeShow = function(objWIZARD, objBUTTON, objEVENT, strLASTPANEL) {
					if(!this.getChild(0)) {
						var me = this;
						ux.megatron.Main.loadUIResourceAsync(me, "ux.cdb.admin","ux/cdb/admin/mechanism/schema/loanassist/builder/step1/ui/SchemaLoanAssistBaseinfoContent.xml", me, me.initialize);
					}
					return null; // return "NONE" to not advance panels
				}

				block.prototype.onAfterHide = function(objWIZARD, objBUTTON, objEVENT, strNEXTPANEL) {
					return null; // return "NONE" to not advance panels
				}
				
				block.prototype.onFinish= function(objWIZARD, objBUTTON, objEVENT, strNEXTPANEL) {
					if (this.doValidate() != true) 
					{
						return "NONE";
					}
					this.wizard.getDescendantsOfType("ux.cdb.admin.mechanism.schema.loanassist.builder.SchemaLoanAssistCmp")[0].saveSchema();
					return null; // return "NONE" to not advance panels
				}
			}
	);
}
